CI: Add SonarCloud integration for abbenay - #106
Conversation
📝 WalkthroughSummary by CodeRabbit
WalkthroughCI now runs daemon coverage tests with ChangesSonarCloud analysis
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant CI
participant GitHub_Actions
participant finalize
participant GitHub_CLI
participant SonarQube_scan
CI->>CI: Run daemon coverage test with xvfb
CI->>GitHub_Actions: Upload LCOV artifact
finalize->>GitHub_Actions: Download coverage artifact
finalize->>GitHub_CLI: Retrieve pull-request metadata
GitHub_CLI-->>finalize: Return base and head branches
finalize->>SonarQube_scan: Run configured analysis
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/ci.yml:
- Around line 65-66: Update the existing daemon coverage step to run through
xvfb-run, then remove the duplicate “Test daemon with coverage” step so daemon
coverage executes only once and preserves the existing coverage output.
In @.github/workflows/finalize.yml:
- Around line 44-64: The workflow_run job must stop trusting executable PR
artifact content for control flow. In .github/workflows/finalize.yml lines
44-64, derive the PR number from the trusted workflow_run.pull_requests payload
or a GitHub API lookup associated with the run, validate it contains only
digits, pass it through env, and reference it as "$PR_NUMBER" in shell commands;
in .github/workflows/ci.yml lines 76-85, remove the PR-number artifact
upload/channel entirely.
- Around line 21-25: Update the Checkout repository step in
.github/workflows/finalize.yml lines 21-25 to set ref to
github.event.workflow_run.head_sha, ensuring scans use the exact CI revision.
Remove the gh pr checkout step at .github/workflows/finalize.yml lines 61-64,
which can replace that revision; both affected sites must be updated so coverage
and sonar.scm.revision use the same source.
In `@sonar-project.properties`:
- Around line 14-17: Update the SonarQube configuration so sonar.sources and
sonar.tests do not share the packages/daemon/src or packages/vscode/src roots;
retain only dedicated test paths in sonar.tests or exclude test files from
sonar.sources, ensuring each .test.ts file is classified exclusively as test
code.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 89cac35f-b605-4425-a1dc-e580088c4dac
📒 Files selected for processing (3)
.github/workflows/ci.yml.github/workflows/finalize.ymlsonar-project.properties
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/finalize.yml:
- Around line 21-27: Update the SONAR_ARGS definition in the finalize workflow
to include the command-line property sonar.host.url=https://sonarcloud.io,
ensuring the scanner always targets SonarCloud regardless of pull-request
changes to sonar-project.properties.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 7c6f56fb-21e7-4673-9177-3c80aff31033
📒 Files selected for processing (3)
.github/workflows/ci.yml.github/workflows/finalize.ymlsonar-project.properties
🚧 Files skipped from review as they are similar to previous changes (1)
- sonar-project.properties
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/finalize.yml:
- Line 121: Update the SONAR_TOKEN environment variable in the workflow to
reference secrets.CICD_ORG_SONAR_TOKEN_CICD_BOT instead of secrets.SONAR_TOKEN,
preserving the existing SonarCloud configuration.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 2b09ba18-2a7a-4aa2-8827-92d6b80ef111
📒 Files selected for processing (1)
.github/workflows/finalize.yml
Summary
sonar-project.propertiesfor SonarCloud analysis of the TypeScript monorepo (packages/daemon,packages/vscode).lcov.info), upload it as a SonarCloud artifact, and store PR metadata for branch analysis.finalizeworkflow that runs after CI and uploads results to SonarCloud (same pattern as other Ansible DevTools repos, e.g.vscode-ansible).SonarCloud project details
redhat-developerredhat-developer_abbenaypackages/daemon/coverage/lcov.infoBlockers / follow-up
SonarCloud access for the
redhat-developerorg is required before this can fully work. A separate ticket has been raised to:redhat-developer/abbenayproject in SonarCloudUntil that is done, the
finalizeworkflow is expected to fail.Test plan
lint-and-test,build,package-python)sonar-coverage) is uploadedfinalizeworkflow completes successfully